Automated document formatting tool

ABSTRACT

A formatting tool enables “smart” copy and paste functions. The “smart” copy and paste functions can be invoked in a context-sensitive manner, depending on the conditions under which the copy and paste functions are implemented. The present invention will automatically include in a selection a paragraph marker at the end of a selected paragraph, if every other textual character in the paragraph has been selected. The present invention will discard a paragraph mark that is included in pasted text if the pasted text is pasted into the middle of another paragraph, indicating that the user prefers the formatting of the pasted-into paragraph. The present invention also reduces inconsistencies in formatting styles that may exist between source and target documents automatically redefining a style in the target document to conform to a corresponding style in the source document. The present invention also automatically adjusts paragraph spacing, in response to text being pasted into a target document. In response to various scenarios, the present invention will determine the most likely paragraph spacing intended by the user and will apply the most probable paragraph spacing to the pasted paragraph. The present invention also automatically adjusts list, table, and spreadsheet formatting, in response to such document elements being pasted into a differently-formatted target document. Finally, the present invention provides a convenient recovery dialog that may be invoked to alter any automatically-implemented formatting decisions.

FIELD OF THE INVENTION

The present invention generally relates to editing electronic documents.More particularly, the present invention relates to automaticallyformatting text that is copied, cut, or pasted.

BACKGROUND OF THE INVENTION

Copying and pasting text is the most widely-used means of introducingcontent to a word processor document. The popularity of the copy andpaste functions stems in large part from the fact that a user can usethe functions to quickly import material from a variety of sources. Wordprocessor users commonly copy and paste material from source documents,such as word processor documents, e-mail notes, spreadsheets documents,and web pages. Unfortunately, pasting material into a target documentoften results in unpredictable formatting behavior. The text that ispasted into the target document is often in a format that is eitherinconsistent with the rest of the document or inconsistent with theuser's expectations. This problem is often made worse by the fact thatthe format of the text in the source document may be different than theformatting of text in the target document. Conventional pastingfunctions also fail to provide recovery mechanisms. Consequently, when auser pastes text into a word processor document, the user must takeaffirmative steps to format the pasted text to the user's liking.

One approach to solving this problem has been to provide a “PasteSpecial” function that permits the user to select from various formatsat the time of pasting the text into the target document. Unfortunately,the user must be aware of the availability of the “Paste Special”functionality and must make an affirmative step to implement thisfunction. Studies of the results provided by instrumented versions ofword processor application programs indicate that the “Paste Special”functionality is not commonly used.

Therefore, there is a need in the art for a formatting tool that canautomatically determine the most likely formatting choices based on thecontext and on the user's behavior. The formatting tool also shouldenable the user to quickly select the formatting of the pasted text. Theformatting tool should operate within the confines of a documenteditor's normal operation, in that it does not require the user to takealternative steps to invoke the automatic formatting. The formattingtool also should provide a recovery mechanism that enables the user toquickly re-format text that has been automatically formatted, when theautomatic formatting is not the desired formatting.

SUMMARY OF THE INVENTION

The present invention satisfies the above-described needs by providing aformatting tool that enables “smart” copy and paste functions. The“smart” copy and paste functions can be invoked in a context-sensitivemanner, depending on the conditions under which the copy and pastefunctions are implemented.

When a user selects a paragraph or a portion of a paragraph to copy, theuser may or may not select the paragraph marker at the end of theparagraph. When a user pastes text having a paragraph marker at the end,the formatting of that pasted text may be different than if the user hadpasted text without the paragraph marker at the end. Usability studiesindicate that users commonly inadvertently include or exclude aparagraph mark from selected text. As a result, a user will commonly besurprised by the formatting behavior upon pasting such selected text.The present invention will automatically include in a selection aparagraph marker at the end of a selected paragraph, if every othertextual character in the paragraph has been selected. This behavior isbased on the assumption that the user intends to select the entireparagraph, as a paragraph, rather than as unformatted text. The user mayoverride this behavior by moving the selection cursor to the left of theparagraph marker before finalizing the text selection. In addition, thepresent invention will discard a paragraph mark that is included inpasted text if the pasted text is pasted into the middle of anotherparagraph, indicating that the user prefers the formatting of thepasted-into paragraph. Thus, the present invention assists a user inselecting and pasting text where a paragraph marker may alter theformatting of the pasted text.

The present invention also reduces inconsistencies in formatting stylesthat may exist between source and target documents. When a user pastesstyled text from a source document the style of the pasted text may beinconsistent with a corresponding style in the target document havingthe same style name. In cases where the corresponding style has not beenused or explicitly redefined in the target document, pasting styled textfrom a source document will redefine the corresponding style in thetarget document. This functionality can also be applied to all otherstyles. However, in one embodiment of the present invention, if anystyle of a group of styles is presently in use in the target document,then none of the other styles in that group will be redefined when thetext is pasted into the target document.

The present invention also automatically adjusts paragraph spacing, inresponse to text being pasted into a target document. Pasting text intoa target document often results in unwanted empty paragraphs orinconsistent paragraph spacing. In response to various scenarios, thepresent invention will determine the most likely paragraph spacingintended by the user and will apply the most probable paragraph spacingto the pasted paragraph.

The present invention also automatically adjusts list formatting, inresponse to text in a list being pasted into a differently-formattedlist in a target document. Pasting list text into an existing list in atarget document often results in inconsistent list formatting. Inresponse to various scenarios, the present invention will determine themost likely list format intended by the user and will apply the mostprobable list format to the pasted list text.

The present invention also automatically adjusts table cell formatting,in response to text from a table being pasted into adifferently-formatted table or into a non-table paragraph in a targetdocument. Pasting table text into an existing table in a target documentoften results in inconsistent table formatting or in an unwanted nestedtable. Similarly, pasting table text into a non-table paragraph canresult in the creation of a new unwanted table in the target document.In response to various scenarios, the present invention will determinethe most likely table formatting (or non-table formatting) intended bythe user and will apply the most probable formatting to the pasted text.

The present invention also automatically determines whether a userpasting a table from a spreadsheet intends to paste an image of thespreadsheet, an object of the spreadsheet application program, or a linkto the spreadsheet document file.

The present invention also automatically resolves style conflictsbetween the source document and the target document to determine themost-likely formatting intentions of the user. The present inventionwill apply a style to pasted text in accordance with this formattingdetermination.

Finally, the present invention will provide a convenient recovery dialogthat may be invoked to alter any automatically implemented formattingdecisions. Thus, if the present invention makes an incorrectdetermination regarding the user's formatting intentions, the formattingmay be easily altered. The user may also turn the automatic formattingtools off in a preferences dialog box.

The various aspects of the present invention may be more clearlyunderstood and appreciated from a review of the following detaileddescription of the disclosed embodiments and by reference to thedrawings and claims.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating an exemplary operatingenvironment for implementation of the present invention.

FIG. 2 is a block diagram depicting an exemplary formatting componentoperating within the context of a word processor.

FIG. 3 is a flow chart depicting an exemplary method for automaticallyre-formatting a document element, in response to the triggering of aformatting rule.

FIG. 4 is a flow chart that depicts an exemplary method forautomatically determining whether to include or exclude a paragraph markfrom a portion of pasted text.

FIG. 5 is a flow chart depicting an exemplary method for recognizing andeliminating an unwanted paragraph mark from selected text.

FIG. 6 is a flow chart depicting an exemplary method for redefiningstyles in a target document.

FIG. 7 is a flow chart depicting an exemplary method for eliminatingempty paragraphs from target and source documents.

FIG. 8 is a flow chart that depicts an exemplary method for merging andcreating lists, in response to a paste operation.

FIG. 9 is a flow chart depicting an exemplary method for formatting atable, in response to copy and paste operations.

FIG. 10 is a flow chart depicting an exemplary method for pastingspreadsheet elements.

FIG. 11 is flow chart depicting an exemplary method for automaticallyadjusting the formatting of pasted text.

FIG. 12 is a flow chart depicting an exemplary method for pasting aspreadsheet chart into a document.

DETAILED DESCRIPTION

In one embodiment of the present invention, a formatting tool isprovided that enables “smart” copy and paste functions. The “smart” copyand paste functions can be invoked in a context sensitive manner,depending on the conditions under which the copy and paste functions areimplemented. The present invention will automatically include in aselection a paragraph marker at the end of a selected paragraph, ifevery other textual character in the paragraph has been selected. Thepresent invention will discard a paragraph mark that is included inpasted text if the pasted text is pasted into the middle of anotherparagraph, indicating that the user prefers the formatting of thepasted-into paragraph.

An embodiment of the present invention reduces inconsistencies informatting styles that may exist between source and target documentsautomatically redefining a style in the target document to conform to acorresponding style in the source document. The present invention alsoautomatically adjusts paragraph spacing, in response to text beingpasted into a target document. In response to various scenarios, thepresent invention will determine the most likely paragraph spacingintended by the user and will apply the most probable paragraph spacingto the pasted paragraph. The present invention also automaticallyadjusts list, table, and spreadsheet formatting, in response to suchdocument elements being pasted into a differently-formatted targetdocument. Finally, exemplary embodiments of the present inventionprovide a convenient recovery dialog that may be invoked to alter anyautomatically-implemented formatting decisions.

An Exemplary Operating Environment

Exemplary embodiments of the present invention will hereinafter bedescribed with reference to the drawings, in which like numeralsrepresent like elements throughout the several figures. FIG. 1illustrates an exemplary operating environment for implementation of thepresent invention. The exemplary operating environment includes ageneral-purpose computing device in the form of a conventional personalcomputer 120. Generally, the personal computer 120 includes a processingunit 121, a system memory 122, and a system bus 123 that couples varioussystem components including the system memory 122 to the processing unit121. The system bus 123 may be any of several types of bus structuresincluding a memory bus or memory controller, a peripheral bus, and alocal bus using any of a variety of bus architectures. The system memoryincludes a read only memory (ROM) 124 and a random access memory (RAM)125. A basic input/output system (BIOS) 126, containing the basicroutines that help to transfer information between elements withinpersonal computer 120, such as during start-up, is stored in ROM 124.

Personal computer 120 further includes a hard disk drive 127 for readingfrom and writing to a hard disk, not shown, a magnetic disk drive 128for reading from or writing to a removable magnetic disk 129, and anoptical disk drive 130 for reading from or writing to a removableoptical disk 131 such as a CD-ROM or other optical media. Hard diskdrive 127, magnetic disk drive 128, and optical disk drive 130 areconnected to system bus 123 by a hard disk drive interface 132, amagnetic disk drive interface 133, and an optical disk drive interface134, respectively. Although the exemplary environment described hereinemploys hard disk 127, removable magnetic disk 129, and removableoptical disk 131, it should be appreciated by those skilled in the artthat other types of computer readable media which can store data that isaccessible by a computer, such as magnetic cassettes, flash memorycards, digital video disks, Bernoulli cartridges, RAMs, ROMs, and thelike, may also be used in the exemplary operating environment. Thedrives and their associated computer readable media provide nonvolatilestorage of computer-executable instructions, data structures, programmodules, and other data for personal computer 120.

A number of program modules may be stored on hard disk 127, magneticdisk 129, optical disk 131, ROM 124, or RAM 125, including an operatingsystem 135, a document editor 136, a formatting component 138, and aformatting rules component 139. Program modules include routines,sub-routines, programs, objects, components, data structures, etc.,which perform particular tasks or implement particular abstract datatypes. Aspects of the present invention may be implemented in the formof a formatting component 138 that can be incorporated into or otherwisein communication with the document editor 136. The document editor 136generally comprises computer-executable instructions for creating ormodifying an electronic document. The formatting component 138 generallycomprises computer-executable instructions for applying and modifyingformatting to text and/or other document elements. The formattingcomponent 138 is generally accessible to the document editor 136, butcan also be implemented as an integral part of the document editor.

A user may enter commands and information into personal computer 120through input devices, such as a keyboard 140 and a pointing device 142.Other input devices (not shown) may include a microphone, joystick, gamepad, satellite dish, scanner, or the like. These and other input devicesare often connected to processing unit 122 through a serial portinterface 146 that is coupled to the system bus 123, but may beconnected by other interfaces, such as a parallel port, game port, auniversal serial bus (USB), or the like. A display device 147 may alsobe connected to system bus 123 via an interface, such as a video adapter148. In addition to the monitor, personal computers typically includeother peripheral output devices (not shown), such as speakers andprinters.

The personal computer 120 may operate in a networked environment usinglogical connections to one or more remote computers 149. Remote computer149 may be another personal computer, a server, a client, a router, anetwork PC, a peer device, or other common network node. While a remotecomputer 149 typically includes many or all of the elements describedabove relative to the personal computer 120, only a memory storagedevice 150 has been illustrated in the figure. The logical connectionsdepicted in the figure include a local area network (LAN) 151 and a widearea network (WAN) 152. Such networking environments are commonplace inoffices, enterprise-wide computer networks, intranets, and the Internet.

When used in a LAN networking environment, the personal computer 120 isoften connected to the local area network 151 through a networkinterface or adapter 153. When used in a WAN networking environment, thepersonal computer 120 typically includes a modem 154 or other means forestablishing communications over WAN 152, such as the Internet. Modem154, which may be internal or external, is connected to system bus 123via serial port interface 146. In a networked environment, programmodules depicted relative to personal computer 120, or portions thereof,may be stored in the remote memory storage device 150. It will beappreciated that the network connections shown are exemplary and othermeans of establishing a communications link between the computers may beused.

Moreover, those skilled in the art will appreciate that the presentinvention may be implemented in other computer system configurations,including hand-held devices, multiprocessor systems, microprocessorbased or programmable consumer electronics, network person computers,minicomputers, mainframe computers, and the like. The invention may alsobe practiced in distributed computing environments, where tasks areperformed by remote processing devices that are linked through acommunications network. In a distributed computing environment, programmodules may be located in both local and remote memory storage devices.

FIG. 2 is a block diagram depicting an exemplary formatting component204 operating within the context of a word processor 200. In thisexemplary embodiment of the present invention word processor 200 is adocument editor that can be used to create and manipulate a sourcedocument 202 and a target document 203. The formatting component 204works in cooperation with the word processor 200 to provide formattingand editing tools for the source document 202 and for the targetdocument 203. The formatting component 204 can maintain informationabout the documents 202, 203 including, but not limited to, informationabout text formatting, table formatting, chart formatting, and listformatting. The formatting component 204 also can control the way thatdocument elements (e.g., text) are cut, copied, and pasted within andbetween the source document 202 and the target document 203.

Text formatting is typically applied to text in the document 202, 203 asa style or as a direct formatting property. Styles are simply namedcollections of formatting properties. For example, a “body text” stylemay include the formatting properties, font: Times Roman, font size: 12point, bold: no, alignment: justified, while a “Headline” style mayinclude the formatting properties, font: Arial, font size: 20, bold:yes. The styles may be applied to text thereby formatting the text inaccordance with the formatting properties that are members of the namedstyle. Of course, each formatting property can be individually appliedto text.

Individualized application of formatting properties to text is referredto as direct formatting. Text may be formatted identically throughdirect formatting and the application of a style. However, styleapplication is a quicker and easier method of applying formattingproperties to the text in a portion of a document. Moreover, styles areused to verify formatting consistency among portions of a document thathave the same style applied to them. Changes to the collection offormatting properties in a style will simultaneously change the formatof all text to which that styles is applied. The formatting component204 of an exemplary embodiment of the present invention maintains arecord of the formatting properties associated with each portion of thedocument 202.

The formatting component 204 of an exemplary embodiment of the presentinvention can automatically re-format a document element that is cut,copied or pasted between documents or between portions of the samedocument. The formatting component 204 can re-format a document element,based on the properties of the document element, the behavior of a user,the context from which the document element was cut or copied, and/orcontext into which the document element is pasted.

One means by which the formatting component 204 can automaticallytrigger re-formatting is through the use of rules maintained in aformatting rules component 206. The formatting rules component canmaintain a list of rules that describe events that can trigger anautomatic re-formatting. For example, one rule might recognize theoccurrence of an event wherein the user attempts to copy and past asingle cell of a table. The formatting rules component 206 may also havea list of responsive actions associated with the list of rules. When arule is triggered, the formatting rules component 206 may instruct theformatting component 204 to execute the associated responsive action.Notably, those skilled in the art will appreciate that not all of theformatting rules need be implemented simultaneously.

The formatting component 204 of an exemplary embodiment of the presentinvention also can provide an On-Object User Interface (OOUI) to enablea user to recover from or reconfigure an automatic reformatting. TheOOUI may be automatically displayed within the context of a documenteditor (e.g., spreadsheet program, word processor, presentation, webpage editor), in response to an automatic re-formatting action taken bythe formatting component 204. The OOUI can be selected by a user toprovide a drop-down menu of available recovery options. Thus, the useris not required to accept the automatic reformatting action taken by theformatting component 204. A more detailed description of the OOUI can befound in co-pending U.S. patent application Ser. No. 09/620,876, filedon Jul. 21, 2000 and assigned to Microsoft Corporation of Redmond, Wash.That patent application is entitled “ON-OBJECT USER INTERFACE” and ishereby incorporated by reference.

Although the descriptions of the inventions provided in connection withFIGS. 4-12 often describe the formatting, copying, and pasting of text,it will be appreciated by those skilled in the art that the presentinvention can be used to automatically format any document element.Document elements can include, but are not limited to, text,spreadsheets, tables, list, and charts.

It will also be appreciated that the OOUI or other recovery userinterface can be displayed following an automatic formatting action toallow a user to reverse the formatting action. In addition, the recoveryuser interface can be displayed following a user's selection of arecovery action and the performance of that recovery action.Accordingly, the user can sequentially select various recovery actionsfrom a recovery user interface to determine the effects of each, beforedeciding on a preferred recovery action. Although the descriptionsprovided in connection with FIGS. 4-12 may not describe the provision ofa recovery user interface following an automatic action or a recoveryaction, those skilled in the art will appreciate that such a recoveryuser interface could be provided within the scope of the embodiments ofthe present invention.

FIG. 3 is a flow chart depicting an exemplary method for automaticallyre-formatting a document element, in response to the triggering of aformatting rule. The method begins at step 300 and proceeds to step 302.At step 302, text is selected for copying or cutting. Typically, this isperformed by a user who selects text using a pointing device (e.g., amouse) that controls a selection cursor and then selecting to copy orcut the selected text from the source document. The method proceeds fromstep 302 to decision block 304. At decision block 304, a determinationis made as to whether a selection formatting rule is applicable. If aselection formatting rule is applicable, the method proceeds to step 306and the selected text is adjusted according to the formatting rule. Themethod then proceeds to step 308 and the paste point is selected in thetarget document. If, on the other hand, a determination is made atdecision block 304 that no selection rule is applicable, the method willbranch directly from decision block 304 to step 308.

The method proceeds from step 308 to decision block 310. At decisionblock 310, a determination is made as to whether a paste formatting ruleis applicable. If a paste formatting rule is applicable, the methodbranches to step 312 and the pasted text is reformatted, in accordancewith a paste formatting rule. The method then proceeds to decision block314, wherein a determination is made as to whether the re-formattingaction is associated with a recovery action. If a determination is madethat the re-formatting action is not associated with a recovery action,the method branches to step 320 and ends.

If, on the other hand, the re-formatting is associated with a recoveryaction, the method branches to step 316 and the recovery user interfaceis displayed (e.g., OOUI). The method then proceeds to decision block318, wherein a determination is made as to whether a recovery action isselected. If a recovery action is not selected, the method branches tostep 320 and ends. If a recovery action is selected, the method branchesto step 322 and the selected recovery action is performed, the methodproceeds from step 322 to step 320 and ends. Although not depicted inFIG. 3, the recovery user interface also may continue to be displayedafter the selected recovery action is performed (i.e., after step 322),so that the first selected recovery action can be undone.

It will be appreciated by those skilled in the art that various methodsfor triggering re-formatting actions and for providing access torecovery actions may be used within the scope of the present invention.FIGS. 4-12 are flow charts that define exemplary methods forre-formatting document elements and for providing recovery options,following such a re-formatting. The flow charts of FIGS. 4-12 do notnecessarily describe the triggering of a formatting rule. However, itwill appreciated by those skilled in the art that the methods describedin FIGS. 4-12 could be implemented with a collection of rules andassociated response of actions or by various other well-known means. Forthe purposes of this description, a document from which text is cut orcopied, is referred to as the source document. The document to whichselected text is pasted is referred to as the target document. Thoseskilled in the art will appreciate that the source document and thetarget document may be the same document.

FIG. 4 is a flow chart that depicts an exemplary method forautomatically determining whether to include or exclude a paragraph markfrom a portion of pasted text. Often, a user may select and copy or cuta paragraph mark (i.e., return character) inadvertently. When such auser pastes the selected text containing the unwanted paragraph mark,the paragraph mark will create a new paragraph in the target document.If, for example, the user only wanted to add a sentence to an existingparagraph, the paragraph mark would break the target paragraph into twoparagraphs. The user would then be required to delete the paragraph markfrom the target paragraph to return the target paragraph to its originalsingle-paragraph form.

Conversely, the user may select an entire paragraph with a paragraphmark at the end, intending to create a new paragraph in a targetdocument with the selected paragraph. This user may inadvertently omitthe paragraph mark from the end of the selected paragraph. In such acase, the selected text will be pasted into the target document as partof the paragraph into which it is pasted. To remedy this problem, theuser must normally find the end of the pasted paragraph and insert aparagraph mark. The method of FIG. 4 is intended to automaticallydetermine whether the user intended to select the paragraph mark and tore-format the pasted text accordingly.

FIG. 4 begins with step 400 and proceeds to step 402. At step 402, textis selected for copying or cutting (collectively, copying). The methodthen proceeds to step 404, wherein the portion of the last paragraphselected is determined. In the case of a single paragraph, this stepwill determine how much of the paragraph was selected for copying. Inthe case where a user is selecting a group of paragraphs, adetermination of the portion of the last paragraph selected will bemade. The method proceeds from step 404 to decision block 406. Atdecision block 406, a determination is made as to whether every textualcharacter in the last paragraph was selected. That is, a determinationis made as to whether every visible character in the last paragraph hasbeen selected for copying by the user. If the user has selected everytextual character in the last paragraph, it may be assumed that the userintended to copy the paragraph as a paragraph (i.e., with a paragraphmark at the end). If on the other hand the user has selected only aportion of the last paragraph, then it can be assumed that the user onlyintended to select the selected text and to paste the selected text aspart of a paragraph in the existing target document. If a determinationis made that not every character in the last paragraph was selected, themethod branches to step 408 and ends. If on the other hand, adetermination is made that every textual character in the last paragraphwas selected, the method branches to decision block 410.

At decision block 410, a determination is made as to whether theparagraph mark was selected. If the paragraph mark was selected, themethod branches to decision block 414. If on the other hand, adetermination is made that the paragraph mark was not selected, a methodbranches to step 412. At step 412, the user's selected text is extendedto include the un-selected paragraph mark. This step essentiallyconverts the pasted text from a non-paragraph to a paragraph. The methodproceeds from step 412 to decision block 414.

At decision block 414 a determination is made as to whether the usermoves the selected cursor to the left. If the user never moves theselected cursor to the left, it may be assumed that the user intends tocopy the entire paragraph, including the paragraph mark. If, on theother hand, the user moves the selection cursor to the left after theselecting the text, it may be assumed that the user seeks to copy onlythe text and does not seek to paste the selected text as an independentparagraph in the target document. If a determination is made that theuser has not moved the selected cursor to the left, the method branchesto step 418 and ends. If, on the other hand, a determination is madethat the user has moved the selection cursor to the left, the methodbranches to step 416. At step 416, the selection is extracted to excludethe paragraph mark, thus converting the selected text from anindependent paragraph to a non-paragraph. The method then proceeds tostep 418 and ends.

FIG. 5 is a flow chart depicting an exemplary method for recognizing andeliminating an unwanted paragraph mark from selected text. The methodbegins at step 500 and proceeds to step 502. At step 502, text isselected for copying or cutting (collectively, copying). The methodproceeds to step 504, wherein the paste point is determined. Typically,a user will determine the paste point by placing an insertion cursor ata location within a target document. The method proceeds from step 504to decision block 506. At decision block 506, a determination is made asto whether one paragraph mark is included in the selected text. If morethan one paragraph mark is included in the selected text, it may beassumed that the user intends to paste the selected text as independentparagraphs. On the other hand, if only one paragraph mark was includedin the selection, it may be assumed that the user may want to paste theselected text as part of a paragraph existing in the target document,rather than as a new, independent paragraph.

If one paragraph mark is included in the selection, the method branchesto decision block 508. If, on the other hand, less than or more than oneparagraph mark is included in the selection the method branches to step516, wherein the selected text is pasted in the paste point. The methodproceeds from step 516 to step 518 and ends.

At decision block 508, a determination is made as to whether the pastepoint is within an existing paragraph in the target document. If thepaste point is within the target paragraph, it may be assumed that theuser may want the selected text to be pasted as part of the targetparagraph. On the other hand, if the paste point is at the beginning orend of paragraphs in the target document, it may be assumed that theuser may want to create a new, independent paragraph in the targetdocument. If a determination is made that the paste point is in themiddle of a target paragraph, the method branches from decision block508 to step 514. At step 514, the single paragraph mark in the selectedtext is eliminated. This elimination will insure that the selected textis pasted as a part of the existing paragraph. The method then proceedsto step 516, wherein the selected text is pasted in the paste point. Themethod proceeds from step 516 to step 518 and ends.

Returning now to decision block 508, if a determination is made that thepaste point is not in the middle of a target paragraph (i.e., the targetlocation is at the beginning or end of one or more paragraphs in thetarget document), the method branches to decision block 510. At decisionblock 510, a determination is made as to whether the paste point iswithin a numbered or bulleted list. If the paste point is not within anumbered or bulleted list, the method branches from decision block 510to step 516. At step 516, the selected text is pasted at the paste pointand the method proceeds to step 518 and ends.

If, at decision block 510, a determination is made that the paste pointis within a numbered or bulleted list the method branches to decisionblock 512. At decision block 512, a determination is made as to whetherthe selected text was a bulleted or numbered list item in the sourcedocument. If a determination is made that the selected text is abulleted or numbered list item the method branches to step 516 and theselected text is pasted as described above. If, on the other hand, adetermination is made at the selected text is not a bulleted or numberedlist item, the method branches to step 514. At step 514, the paragraphmark is eliminated from the selected text and the method proceeds tostep 516, wherein the selected text is pasted as described above. Bydetermining whether the selected text was originally a bulleted ornumbered list item, the method can make an assumption as to whether theuser intended to paste the selected text as a new list item or simply asa part of an existing list item.

FIG. 6 is a flow chart depicting an exemplary method for redefiningstyles in a target document. The method of FIG. 6 starts at step 600 andproceeds to step 602. At step 602, text is selected from a sourcedocument for copying or cutting. For the purposes of this description,the term “copying” will be used to describe the function of copying andpasting in the context of a word processor. The method proceeds to step604, wherein the target document and the paste point within the targetdocument are determined. As described in connection with FIG. 5, thisdetermination is usually made by a user defining an insertion point. Themethod then proceeds to decision block 606, wherein a determination ismade as to whether the selected text has a style associated with theselected text.

Text formatting is typically applied to text in a document as a style oras a direct formatting property. Styles are well known and are simplynamed collections of formatting properties. Styles may be applied totext to format the text in accordance with the formatting propertiesthat are members of the style. Individualized application of formattingproperties to text is referred to as direct formatting. Text may beformatted identically through direct formatting or through theapplication of a style. Advantageously, styles can be used to insureformatting consistency among portions of a document that have the samestyle associated with them.

If a determination is made at step 606 that the selected text has anassociated style, the method branches to decision block 607. At decisionblock 607, a determination is made as to whether a corresponding styleexists in the target document. If a corresponding style exists in thetarget document, then the styles must be reconciled. If on the otherhand, no corresponding style exists in the target document, the methodbranches to step 612. At step 612, the selected text is pasted at thepaste point. The method proceeds from step 612 to step 614. At step 614,the pasted text is formatted in its original, associated style. Themethod then proceeds to 616 and ends.

If a determination is made at decision block 607 that a correspondingstyle exists in the target document, the method branches to decisionblock 608. At decision block 608, a determination is made as to whethera corresponding style in the target document belongs to a style group.Style groups are well-known collections of styles that are grouped forvarious reasons. For example, heading styles may be used to associatevarious heading styles with a particular hierarchy. Such a hierarchy maybe used, for example, to create an ordered table of contents. If, on theother hand, a determination is made that a corresponding style exists inthe target document, the method branches from decision block 607 todecision block 608.

If, at decision block 608, a determination is made that thecorresponding style does not belong to a style group, the methodproceeds to decision block 610. At decision block 610, a determinationis made as to whether the corresponding style as been used or redefinedin the target document. If the corresponding style has not been used orredefined in the target document then the style of the selected text canbe used to redefine the corresponding style. In this case, the methodbranches from decision block 610 to step 618. At step 618, thecorresponding style is set equal to the source document style (i.e., thestyle of the selected text). The method then proceeds to step 612 andproceeds as described above. Returning now to decision block 610, if thecorresponding style has been used or redefined in the target document,the style in the target document will not be redefined to match thestyle of the selected text. In this case, the method branches fromdecision block 610 to step 612 and proceeds as described above. Notably,the pasted text will maintain its original style, but the style in thetarget document will not, nonetheless, be redefined.

Returning now to decision block 608, if a determination is made that thecorresponding style in the target document belongs to a style group, themethod branches to decision block 620. At decision block 620, adetermination is made as to whether any style in the style group hasbeen used or redefined in the target document. If any style in the stylegroup has been used or redefined in the target document, then it may beassumed that the user may want to retain the definitions of the stylesin the style group. In this case, the method branches from decisionblock 620 to step 612 and proceeds as described above. If, on the otherhand, no style in the style group has been used or redefined in thetarget document, the method branches from decision block 620 to step618. At step 618, the corresponding style is set equal to the sourcedocument style, as described above. The method then proceeds to step 612and the selected text is pasted in the paste point.

Although the method of FIG. 6 describes maintaining the pasted text inits original style, it will be appreciated by those skilled in the artthat the pasted text may be reconfigured to adopt the formattingproperties of the corresponding style. This option may be selected bythe user in a preferences file or may be selected by user using an OOUI,as described above on a case-by-case basis. Additionally, the method ofFIG. 6 may be modified within the scope of the present invention toinclude the step of displaying a recovery user interface to enable theselection of recovery actions associated with the performance of aparticular paste action and/or style reformatting (e.g., after step612). In one embodiment of the present invention, one such recoveryaction includes negating an automatic application of a source documentstyle and the application of a corresponding target document style tothe pasted text or vice versa.

FIG. 7 is a flow chart depicting an exemplary method for eliminatingempty paragraphs from target and source documents. Often, a user willcut text from a source document for pasting into a target document, butwill leave the source document with unwanted empty paragraphs.Additionally, when a user pastes text into a target document the userwill often paste unwanted paragraphs into the target document. Themethod of FIG. 7 can determine when it is most likely that the userintended to eliminate an empty paragraph from either the selected(copied or cut) text or from the pasted text.

The method starts at step 700 and proceeds to step 702. At step 702,text is selected from the source document for cutting or copying. Themethod then proceeds to decision block 704, wherein a determination ismade as to whether the text selection was made by a copy action. If thetext selection was made by a copying action, the method branches to step712. If, on the other hand, the text was not selected by a copyingaction (i.e., the text was selected by a cut action), the methodbranches to decision block 706.

At decision block 706, a determination is made as to whether the textwas cut from the beginning or end of the source document. If the textwas cut from either the beginning or the end of the source document, themethod branches to step 712. If, on the other hand, the text was not cutfrom either the beginning or the end of the source document, the methodbranches to decision block 708. At decision block 708, a determinationis made as to whether the number or empty paragraphs between the closestnon-empty paragraphs are more than a pre-defined threshold value. Thepre-defined threshold value may simply be an estimate as to the numberof empty paragraphs present in the source document that may indicatethat the user intends to remove empty paragraphs from the sourcedocument by virtue of the cutting action. If the number of emptyparagraphs is more than the pre-defined threshold value, the methodbranches to step 712. If the number of empty paragraphs is less than orequal to the threshold value, the method branches to step 710.

At step 710, all empty paragraphs found between the cut point and thenext (following) non-empty paragraph are eliminated from the sourcedocument. Naturally, this step is performed when a determination is made(by decision block 708) that the user intended for the empty paragraphsto be removed from the source document. The method proceeds from step710 to step 712. At step 712, the target document and paste point aredetermined. Typically, this will be performed by a user opening and/orinstantiating a target document and selecting a paste point with apointing device, such as a mouse.

The method proceeds from step 712 to decision block 714. At decisionblock 714, a determination is made as to whether the paste point is in anon-empty paragraph. If the paste point is not in a non-empty paragraph,the method branches to decision block 724. At decision block 724, adetermination is made as to whether the paste point is at the beginningor the end of the target document. If the paste point is not at eitherthe beginning or the end of the target document, the method branches tostep 726. At step 726, the selected text (i.e., the copied text or thecut text) is pasted in the target document at the paste point and noparagraph adjustments are made to the text in the target document. Themethod proceeds from step 726 to step 734 and ends.

Returning now to decision block 714, if a determination is made that thepaste point is in a non-empty paragraph, the method branches to decisionblock 716. At decision block 716, a determination is made as to whetherthe selected text consists of only one paragraph. If the selected textconsists of only one paragraph, the method branches to step 726 andproceeds as described above. If, on the other hand, a determination ismade at decision block 716 that the selected text consists of more thanone paragraph, the method branches to step 718. At step 718, a spacingadjustment is set equal to the number of empty paragraphs between thenon-empty paragraph containing the paste point and a preceding non-emptyparagraph.

The method proceeds from step 718 to decision block 720. At decisionblock 720, a determination is made as to whether the paste point islocated in a list of the target document. If the paste point is locatedin a list, then the spacing adjustment is set to zero. The methodproceeds from step 722 to step 732. At step 732, the selected text ispasted at the paste point and the target document and the number ofparagraphs between each pasted non-empty paragraph is set to the spacingadjustment determined above (e.g., step 718, step 722). The method thenproceeds to step 734 and ends. Notably, and an alternative embodiment, adetermination can be made as to whether the spacing adjustment isgreater than a predefined threshold value. If the spacing adjustment isgreater than that pre-defined threshold value, the spacing adjustmentcan be set equal to the pre-defined threshold value.

Returning to decision block 720, if a determination is made that thepaste point is not in a list, the method branches to decision block 728.At decision block 728, a determination is made as to whether theselected text is itself a list. If a determination is made that theselected text is a list, a method branches to step 726 and the selectedtext is pasted as the paste point with no paragraph spacing adjustments.The method then proceeds to step 734 and ends.

If, on the other hand, a determination is made at decision block 728that the selected text is not a list, the method branches to step 732.At step 732, the selected text is pasted in the target document at thepaste point and the number of empty paragraphs between each pastednon-empty paragraph is set to the spacing adjustment determined above(i.e., step 718). The method then proceeds to step 734 and ends.Returning now to decision block 724, if a determination is made that thepaste point is at the beginning or the end of the target document, themethod branches from decision block 724 to step 730. At step 730, thespacing adjustment is set equal to the number of empty paragraphsbetween the first non-empty paragraph preceding the paste point and thefirst non-empty paragraph following the paste point. The method thenproceeds to decision block 720 and proceeds as described above.

Step 710 is also performed when the method branches from decision blocks704, 706, and 708. If, at decision block 704, a determination is madethat the selected text was selected by way of a copy action, then themethod branches to step 712 to determine the target document and pastepoint. Because no cutting action is involved, there is no need toperform step 710, which eliminates empty paragraphs from the sourcedocument. Likewise, when a determination is made at decision block 706that the selected text was cut from the beginning or end of the sourcedocument, an assumption is made that empty paragraphs need not beremoved, and the method branches around step 710 to step 712. Finally,where a determination is made at decision block 708 that the number ofempty paragraphs between the closest (to the cut point) non-emptyparagraphs is greater than the predefined threshold value, then anassumption is made that not empty paragraphs need to be removed. Thus,the method branches from decision block 708 to step 712.

As described, the method of FIG. 7 analyzes the selected text from asource document, the selection action (e.g., cutting or copying), andthe paste point in the target document to determine whether emptyparagraphs should be eliminated from either document during a cut/copyand/or paste operation. When the selected text is at the beginning orend of the source document, the selected text will be cut from thesource document without any paragraph elimination. Similarly, if thepaste point is at the beginning or end of the target document, theselected text will be pasted without any empty paragraph elimination.The threshold values for cutting and/or pasting may be predetermined bya hard-coded configuration file, a configurable user preferences file,or an options dialog box. Essentially, however, the threshold value issimply an estimate as to the number of preceding or following paragraphsthat will be recognized as an indication that a user intends for emptyparagraphs to be present.

FIG. 8 is a flow chart that depicts an exemplary method for merging andcreating lists, in response to a paste operation. The method starts at800 and proceeds to step 802. At step 802, the list text is selected forcopying. List text is text that is an item in a numbered or bulletedlist. The list text may be a portion of a list item (i.e., notcontaining a paragraph mark) or an entire list item (i.e. containing atleast one paragraph mark).

The method proceeds from step 802 to step 804. At step 804, the pastepoint is determined. Typically, the paste point will be determined by auser's defining an insertion point in a target document. The methodproceeds from step 804 to decision block 806. At decision block 806, adetermination is made as to whether the paste point is immediatelypreceded or followed by a list paragraph. That is, it is determinedwhether the paste point is next to a list item in a list. If the pastepoint is immediately preceded or followed by a list paragraph (i.e.,list item), the method branches to step 808. At step 808, the selectedlist text is merged with the list in which the list paragraph resides.That is, the pasted text is made part of the existing list in the targetdocument. Merging the selected text with the existing list may alsoinclude formatting the selected list text as the existing list isformatted.

The method proceeds from step 808 to step 816 and the selected text ispasted into the target document at the paste point as part of theexisting list preceding or following the paste point. At step 816, anassumption is made that the user intends for the pasted list text to bemade part of the existing list. Those skilled in the art will appreciatethat an alternative embodiment of the present invention could useanother default assumption, such as making the pasted text a new,independent list.

The method proceeds from step 816 to step 814 and a recovery userinterface is displayed. In one embodiment of the present invention, therecovery interface may provide the options to merge the pasted list textas part of the target document's existing list or to make the pastedlist text a new, independent list. Of course, other recovery optionsalso may be provided. The method proceeds from step 814 to decisionblock 820. At decision block 820, a determination is made as to whethera recovery selection is made. If a recovery selection is made, themethod branches to step 812 and the selected recovery action isperformed. In the example of FIG. 8, step 812 formats the pasted text asa new, independent list as a recovery action corresponding to thedefault action performed in step 816 (pasting the selected text as apart of the original list). The method proceeds from step 812 to step818 and ends. If a determination is made at decision block 820 that norecovery action is selected, the method branches to step 818 and ends.

Returning now to decision 806, if a determination is made that the pastepoint is not immediately preceded or followed by a list paragraph, themethod branches to step 810, the selected list text is pasted at thepaste point as a new, independent list. The method then proceeds to step818 and ends.

FIG. 9 is a flow chart depicting an exemplary method for formatting atable, in response to copy and paste operation. The method of FIG. 9starts at step 900 and proceeds to step 902. At step 902, table text isselected for copying or cutting (collectively, copying). Table text isany text that is at least part of a table in a source document. Tablesare typically divided into columns and rows of cells. Oftentimes, whentable text is copied and pasted, it is difficult to determine whether itis intended to be pasted as a new table, part of an existing table, orsimply as non-table text. The method of FIG. 9 automatically selectsbetween these options, based on the location of the selected table text,the paste point and the actions of the user with respect to a recoveryuser interface.

The method proceeds from step 902 to step 904. In step 904, the pastepoint is determined. Typically, the paste point will be determined bythe user's placement of an insertion point cursor in the targetdocument. The method proceeds from step 904 to decision block 906. Atdecision block 906, a determination is made as to whether the pastepoint is an immediately preceded or followed by a table. If the pastepoint is not immediately preceded or followed by a table, the methodbranches to decision block 908. At decision block 908, a determinationis made as to whether the paste point is within a table. If the pastepoint is not within a table, the method branches to step 910. At step910, a determination is made as to whether the selected table text is asingle cell. If the selected table text is not a single cell, the methodbranches to step 920 and ends.

Returning now to decision block 906, if a determination is made that thepaste location is immediately preceded or followed by a table, themethod branches to decision block 912. At decision block 912, adetermination is made as to whether the selected table text and thepreceding or following table have the same number of columns. If theselected table text and the existing table do not have the same numberof columns, the method branches from decision block 912 to step 918. Atstep 918, the selected table text is pasted at the paste point and isformatted as the target table is formatted. The method then proceedsfrom step 918 to step 920 and ends.

Returning now to decision block 912, if a determination is made that theselected table text and the existing table have the same number ofcolumns, the method branches to step 914. At step 914 the selected tabletext is merged with the target table. The merger of the table elementscreates a single table and pasted table text will have the same tableformatting as the existing table. The method proceeds from step 914 to916. At decision block 916, a determination is made as to whether arecovery action has been selected. Typically, the recovery action willbe made available via an OOUI (not shown). If no recovery action isselected, the method branches from decision block 916 to step 920 andends. If, on the other hand, the user selects a recovery action, themethod will branch to step 918 and the selected table text will bepasted in the paste point as originally formatted. Thus, the tablemerger of step 914 will be overridden by the selection of the recoveryaction. The method proceeds from step 918 to 920 and ends.

Returning now to step 908, if a determination is made that the pastepoint is within an existing table, the method branches to step 926. Atstep 926, the selected table is pasted in the pasted location as anested table. That is, the pasted table text will be an independenttable within the existing table. Notably, the selected table text willbe pasted as it was originally formatted in the source document. Themethod proceeds from step 926 to step 928. At step 928, a recovery userinterface (e.g., an OOUI) is displayed. The method then proceeds todecision block 930. At decision block 930, a determination is made as towhether the user selects a recovery action from the recovery userinterface. If no recovery selection is made, the method branches to step946 and ends. If, on the other hand a determination is made at decision930 that a recovery action has been selected, the method branches todecision block 934.

At decision block 934, a determination is made as to whether the mergetable recovery action has been selected. If the merge table recoveryaction has been selected, the method branches from decision block 934 tostep 948. At step 948, the selected table text is merged with theexisting table (i.e., the target table). As described above, theselected table text will be formatted in accordance with the targettable. The method then proceeds to step 946 and ends.

Returning now to decision block 934, if a determination is made atdecision block 934 that the merge table recovery action has not beenselected, the method branches to decision block 936. At decision block936, a determination is made as to whether the insert as new rowsrecovery action is selected by the user. If the insert as new rowsrecovery action is selected by the user, the method branches to step924. At step 924, the selected table text is inserted within the targettable as new rows. Obviously, the columns may or may not line up withthe columns of the columns of the target table. The method proceeds fromstep 924 to step 920 and ends.

Notably, if a determination is made at decision block 936 that theinsert as new rows recovery action has not been selected, the methodbranches from decision block 936 to step 922. At step 922 the selectedtable text is pasted into the target table by overwriting existingcells. The method proceeds from step 922 to 920 and ends.

Returning now to decision block 910, if a determination is made that theselected table text is a single cell, the method branches to step 938.At step 938, the cell contents are pasted as regular text at the pastepoint. The method proceeds to step 940, wherein a recovery userinterface is displayed. The method proceeds from step 940 to decisionblock 942. At decision block 942, a determination is made as to whethera recovery action is selected. If no recovery action is selected, themethod branches to step 946 and ends. On the other hand, if a recoveryaction is selected, the method branches to step 944. At step 944, thecell is pasted as a single cell table. The method proceeds from step 944to 946 and ends.

FIG. 10 is a flow chart depicting an exemplary method for pastingspreadsheet elements. The method of FIG. 10 starts at step 1000 andproceeds to step 1002. At step 1002, at least a portion of a spreadsheettable is selected for copying or cutting (collectively, copying). Thespreadsheet table may be in a document hosted by a spreadsheetapplication program (such as Microsoft Excel, marketed and manufacturedby Microsoft Corporation of Redmond, Wash.) or may be a spreadsheetobject embedded in a source document. In either case, the spreadsheetfunctionality may be imported into the target document maintaining alink with the spreadsheet. On the other hand, a non-functionalspreadsheet table of values may be pasted into the target document.

The method proceeds from step 1002 to step 1004. At step 1004, a pastepoint is determined. Typically the paste point is determined by the userdefining an insertion point in the target document. The method proceedsfrom step 1004 to decision block 1006. At decision block 1006, adetermination is made as to whether the selected table has been importedfrom a spreadsheet. If the table has not been imported from aspreadsheet, then the method branches to step 1030 and the spreadsheetis simple pasted as a table with the default formatting of the targetdocument. On the other hand, if a determination is made at decisionblock 1006 that the selected table is imported from a spreadsheet, themethod branches to decision block 1008. At decision block 1008, adetermination is made as to whether the selected table is a single celltable. If the selected table is not a single cell table, the methodbranches to step 1010. At step 1010, the spreadsheet is pasted in thetarget document as a table with its original formatting. The method thenproceeds to step 1014.

Returning now to decision block 1008, if a determination is made thatthe selected table is a single cell table, a method branches to step1012. At step 1012, the cell contents are simple pasted in the targetdocument as text. The method then proceeds to step 1014. At step 1014, arecovery user interface is displayed. The method then proceeds todecision block 1016. At decision block 1016, a determination is made asto whether a match target table style recovery action is selected fromthe recovery user interface. If the matched target table style recoveryaction is selected, the method branches from decision block 1016 to step1024. At step 1024, the spreadsheet table is pasted as a table with thedefault formatting of the target document then proceeds to step 1022 andends.

If at decision block 1016, a determination is made that the user has notselected the matched target table style recovery action, the methodbranches to decision block 1018. At decision block 1018 a determinationis made as to whether the user has selected the keep text only recoveryaction. If the user has selected the keep text only recovery action, themethod branches to step 1026. At step 1026, the spreadsheet table ispasted as unformatted text. The method then proceeds to step 1022 andends. If, on the other hand, at decision block 1018 a determination ismade that the user has not selected the keep text only recovery action,the method branches to decision block 1020. At decision block 1020, adetermination is made as to whether the user has selected the keepsource formatting with link recovery action. If the user has selectedthis recovery action, the method branches to step 1028. At step 1028,the spreadsheet table is pasted as a table with its original formattingand with a link to the original spreadsheet table. This link willmaintain the functionality of the spreadsheet within the target documentso that changes to the original spreadsheet will be reflected in thepasted spreadsheet table. The method then proceeds to step 1022 andends. If at decision block 1020, a determination is made that the userhas not selected the keep source formatting with link recovery action,the method branches to decision block 1032.

At decision block 1032, a determination is made as to whether the userhas selected the match target table formatting with link recoveryaction. If the user has selected this recovery action, the methodbranches to step 1030. At step 1030, the spreadsheet table as pasted asa table with the default formatting of the target document. The methodthen proceeds to step 1022 and ends.

If at decision block 1032, a determination is made that the user has notselected the match target table formatting with link recovery action,the method branches to decision block 1034. At decision block 1034, adetermination is made as to whether the apply style or formattingrecovery action has been selected. If this recovery action has beenselected, the method branches to step 1036. At step 1036, a formattinguser interface is displayed with which the user may format the selectedtable text. A detailed description of the formatting user interface isdescribed in a co-pending U.S. patent application Ser. No. ______,(Attorney Docket No.: 60001.0046US01) also assigned to MicrosoftCorporation of Redmond, Wash. That patent application is entitled“INTERACTIVE FORMATTING INTERFACE” and is hereby incorporated byreference. The method of FIG. 10 proceeds from step 1036 to step 1038and ends. Returning to decision block 1034, if a determination is madethat the user has not selected the apply style or formatting recoveryaction, then it is assumed that the user has not selected a recoveryaction in the method branches to step 1038 and ends.

In an alternative embodiment of the present invention, the methods ofFIGS. 9 and 10 can be integrated, such that the pasting of a spreadsheettable (FIG. 10) can be processed identically as any other tableprocessed according to the method of FIG. 9. In this embodiment, themethod of FIG. 10 is modified to follow the “NO” branch from decisionblock 1006 to step 904 of the method of FIG. 9. The method of FIG. 10could be further modified by following the “YES” branch from decisionblock 1006 to a new decision block that determines whether the pastepoint is immediately preceded or followed by a table. If it isdetermined that the paste point is immediately preceded or followed by atable, then the method of this embodiment would branch to step 926 ofFIG. 9. If it is determined that the paste point is not immediatelypreceded or followed by a table, then the method would branch to asecond new decision block, wherein a determination is made as to whetherthe paste point is within a table. If the paste point is within a table,the method branches to step 938 of FIG. 9. If the paste point is notwithin a table, then the method branches to step 1008 of FIG. 10.

FIG. 11 is flow chart depicting an exemplary method for automaticallyadjusting the formatting of pasted text. Like the method depicted inFIG. 6, the method of FIG. 11 provides automatic format adjustment forpasted text. However, the method of FIG. 11 also provides a recoveryuser interface that allows the reversal of an automatic formatting.

The method of FIG. 11 starts at step 1100 and proceeds to step 1102. Atstep 1102, text is selected for a copying or cutting. The method thenproceeds to step 1104. At step 1104, the paste point is determined. Themethod then proceeds from step 1104 to decision block 1106.

At decision block 1106, a determination is made as to whether theselected text has an associated style that has been used and/or modifiedin the target document. If the selected text has such a style, themethod branches to step 1110. At step 1110, the text is pasted at thepaste point with the style of the target document. Any direct formattingthat has been applied to the pasted text (in the source document) isretained. The method proceeds from step 1110 to step 1114. If atdecision block 1106, a determination is made that the selected text isnot associated with a style that has been used or modified in the targetdocument, the method branches to step 1112. At step 1112, the selectedtext is pasted at the paste point with the style of the source documentand all direct formatting is retained. The method then proceeds to step1114.

At step 1114, a recovery user interface is displayed. The methodproceeds from step 1114 to decision block 1116. At decision block 1116,a determination is made as to whether the match target document stylesrecovery action is selected from the recovery user interface. If thematched target document styles recovery action is selected, the methodbranches to step 1124. At step 1124, the selected text is pasted at thepaste point with the style of the target document and all directformatting is retained. The method then proceeds to step 1122 and ends.

If at decision block 1116, a determination is made that the match targetdocument styles recovery action is not selected, the method branches todecision block 1118. At decision block 1118, a determination is made asto whether the keep source styles recovery option is selected. If thisrecovery option is selected, the method branches to step 1126. At step1126, the selected text is pasted at the paste point with the style ofthe source document and all direct formatting is retained. The methodthen proceeds to step 1122 and ends.

If at decision block 1118, a determination is made that the keep sourcestyles recovery action is not selected, the method branches to decisionblock 1120. At decision block 1120, a determination is made as towhether the keep text only recovery action has been selected. If thisrecovery action has been selected, the method branches to step 1128 andthe selected text is pasted at the paste point as unformatted text. Themethod then proceeds to step 1122 and ends.

If a determination is made as decision block 1120 that the keep textonly recovery action had not been selected, the method branches todecision block 1130. At decision block 1130, a determination is made asto whether the apply style or formatting recovery action has beenselected. If this recovery action has been selected, the method proceedsto step 1132. If this recovery action has not been selected, the methodbranches to step 1134 and ends. At step 1132, the formatting userinterface described above in connection with FIG. 10 is displayed. Thisuser interface allows the user to format the selected text as desired.The method proceeds from step 1132 to step 1134 and ends.

The method of FIG. 11 also could be modified to include other recoveryoptions in addition to the recovery actions provided by step 1124(matching the styles of the target document), step 1126 (keeping sourceformatting), and step 1128 (keeping the source text only). For example,a recovery action that preserves the styles of the source document couldbe added (like step 1112). Those skilled in the art will appreciate thatvarious recovery options could be added to the recovery user interfacewithin the scope of the present invention.

FIG. 12 is a flow chart depicting an exemplary method for pasting aspreadsheet chart into a document. The method of FIG. 12 starts at step1200 and proceeds to step 1202, the spreadsheet chart is selected forcopying. A spreadsheet chart is generally a graphical representation ofdata in a spreadsheet. If the spreadsheet chart is pasted as an objector with a link, the spreadsheet chart may retain its functionality. Ifthe spreadsheet chart is pasted as a picture, the original values willbe retained, but the functionality of the chart will not be retained.

The method proceeds from step 1202 to 1204. At step 1204, a paste pointis determined. The method then proceeds to step 1206. At step 1206, thespreadsheet chart is pasted into the target document as a picture. Themethod proceeds from step 1206 to step 1208.

At step 1208, a recovery user interface is displayed. The methodproceeds to decision block 1210, wherein a determination is made as towhether the paste as object recovery action has been selected from therecovery user interface. If this recovery action has been selected, themethod branches to step 1216. If this recovery action has not beenselected, the method branches to decision block 1212. At step 1216, thespreadsheet chart is pasted into the target document as an object. Thoseskilled in the art will appreciate that an object will maintain all orportion of the functionality of the application program in which thespreadsheet chart was created. The method proceeds from step 1216 to1214 and ends.

If a determination is made at decision block 1210 that the paste asobject recovery action has not been selected, the method branches todecision block 1212. At decision block 1212, a determination is made asto whether the paste as object with link recovery action has beenselected. If this recovery action has been selected, the method branchesto step 1218. If this recovery action has not been selected, the methodbranches to step 1214 and ends. At step 1218, the spreadsheet chart ispasted as an object with a link to the original spreadsheet. The linkwill insure that changes to the original spreadsheet will be reflectedin the pasted spreadsheet chart. The method proceeds from step 1218 tostep 1214 and ends.

Although the present invention has been described in connection withvarious exemplary embodiments, those of ordinary skill in the art willunderstand that many modifications can be made thereto within the scopeof the claims that follow. For example, although the embodiments of thepresent invention have been described in which the formatting componentand formatting rules component are independent components, those skilledin the art will appreciate that the invention may be implemented suchthat these components are integral parts of the document editor.Accordingly, it is not intended that the scope of the invention in anyway be limited by the above description, but instead be determinedentirely by reference to the claims that follow.

1-21. (canceled)
 22. A computer-readable medium having stored thereoncomputer-executable instructions which, when executed by a computer,cause the computer to: determine the selection of the document element;determine the portion of the paragraph represented by the selecteddocument element; determine whether a paragraph mark is included in theselected document element; and add the paragraph mark to the selecteddocument element in response to a determination that the entireparagraph has been selected and that the paragraph mark has not beenincluded in the selected document element.
 23. The computer-readablemedium of claim 22, further comprising computer-executable instructionsstored thereon which, when executed by a computer, cause the computerto: determine whether a selection action indicates a desire to de-selectthe paragraph mark; and eliminate the paragraph mark from the selecteddocument element in response to a determination that the selectionaction indicates a desire to de-select the paragraph mark.
 24. Thecomputer-readable medium of claim 23, wherein causing the computer todetermine whether the selection action indicates a desire to de-selectthe paragraph mark comprises causing the computer to determine whether aselection cursor has been moved in a leftward direction.
 25. Thecomputer-readable medium of claim 23, further comprisingcomputer-executable instructions stored thereon which, when executed bya computer, cause the computer to: determine a paste point in a targetdocument; and paste the document element as an independent paragraph ifthe entire paragraph has been selected and no selection action has beenmade that indicates a desire to de-select the paragraph mark.
 26. Thecomputer-readable medium of claim 25, further comprisingcomputer-executable instructions stored thereon which, when executed bya computer, cause the computer to: determine whether the paste point iswithin a paragraph in the target document; and eliminate the paragraphmark from the selected document element in response to a determinationthat the paste point is within the paragraph in the target document. 27.The computer-readable medium of claim 22, wherein the selection of thedocument element includes an instruction to copy the document element.28. The computer-readable medium of claim 22, wherein the selection ofthe document element includes an instruction to cut the documentelement.
 29. A method for eliminating a paragraph mark from a documentelement selected from a source document, the method comprising:determining the selection of the document element in the sourcedocument; determining a paste point in a target document; determiningwhether a paragraph mark is included in the document element;determining whether the paste point is within a paragraph in the targetdocument; and eliminating the paragraph mark from the document element,in response to a determination that the paste point is within theparagraph in the target document and that the paragraph mark is includedin the document element.
 30. The method of claim 29, further comprisingpasting the selected document element at the paste point as a part ofthe paragraph in the target document.
 31. The method of claim 29,further comprising: determining whether an entire paragraph isrepresented by the selected document element; in response to determiningthat the selected document element represents an entire paragraph, thatthe paragraph mark is not included in the selected document element, andthat the paste point is not within the paragraph in the target document,adding the paragraph mark to the selected document element; and pastingthe document element as an independent paragraph at the paste point inthe target document.
 32. The method of claim 29, further comprising:determining whether the document element is a list item; determiningwhether the paste point is within a list in the target document; andeliminating the paragraph mark from the document element, in response toa determination that the paste point is within the list in the targetdocument, that the paragraph mark is included in the document element,and that the document element is not a list item.
 33. A method foreliminating empty paragraphs from a document, the method comprising:determining the selection of a document element in a source document;determining a first number of preceding empty paragraphs adjacent to thedocument element; determining a first number of following emptyparagraphs adjacent to the document element; determining a total of thefirst number of preceding empty paragraphs and the first number offollowing empty paragraphs; and eliminating the following emptyparagraphs from the source document, in response to a determination thatthe total is less than a first predetermined threshold value.
 34. Themethod of claim 33, further comprising: determining a paste point in atarget document; determining if the paste point is in a non-emptyparagraph; if the paste point is not in a non-empty paragraph,determining if the paste point is at the beginning or end of the targetdocument; and if the paste point is not in a non-empty paragraph and ifthe paste point is not at the beginning or end of the target document,pasting the document at the paste point in the target document.
 35. Themethod of claim 34, further comprising: determining a second number ofpreceding empty paragraphs adjacent to the paste point; determining asecond number of following empty paragraphs adjacent to the paste point;determining a total of the second number of preceding empty paragraphsand the second number of following empty paragraphs; and if the pastepoint is at the beginning or end of the target document, pasting thedocument element at paste point in the target document with the numberof empty paragraphs between each pasted non-empty paragraph equal to thetotal of the second number of preceding empty paragraphs and the secondnumber of following empty paragraphs.
 36. The method of claim 33,further comprising: determining a paste point in a target document;determining if the paste point is in a list within the target document;if the paste point is not in a list, determining if the document elementis a list; and if the document element is a list, pasting the documentat the paste point in the target document.
 37. The method of claim 36,further comprising: determining a second number of preceding emptyparagraphs adjacent to the paste point; determining a second number offollowing empty paragraphs adjacent to the paste point; determining atotal of the second number of preceding empty paragraphs and the secondnumber of following empty paragraphs; and if the paste point is not in alist and the document element is not a list, pasting the documentelement at paste point in the target document with the number of emptyparagraphs between each pasted non-empty paragraph equal to the total ofthe second number of preceding empty paragraphs and the second number offollowing empty paragraphs.
 38. The method of claim 36, furthercomprising: if the paste point is in a list, pasting the documentelement at the paste point in the target document with no paragraphsbetween each pasted non-empty paragraph.
 39. The method of claim 34,further comprising: if the paste point is in a non-empty paragraph,determining if the document element comprises only one paragraph; and ifthe document element comprises only one paragraph, pasting the documentelement at the paste point in the target document.
 40. The method ofclaim 39, further comprising: determining a second number of precedingempty paragraphs adjacent to the paste point; if the document elementcomprises more than one paragraph, pasting the document element at thepaste point in the target document with the number of empty paragraphsbetween each pasted non-empty paragraph equal to the second number ofpreceding empty paragraphs.
 41. The method of claim 40, furthercomprising: determining if the paste point is in a list within thetarget document; if the paste point is not in a list, determining if thedocument element is a list; and if the document element is a list,pasting the document at the paste point in the target document.